<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			window.onload = function(){
				
				
				//定义方法
				function change(a,b){
					var a1 = document.getElementById(a);
					var b1 = document.getElementById(b);
					
					var clone1 = a1.cloneNode(true);
					var clone2 = b1.cloneNode(true);
					
					var parent1 = a1.parentNode;
					var parent2 = b1.parentNode;
					
					parent1.replaceChild(clone1,b1);//替换
					parent2.replaceChild(clone2,a1);//替换
					
				}
				
				change("city","game");
			}
		</script>
	</head>
	<body>
		<p>你喜欢哪个城市</p>
		<ul id="city">
			<li id="bj" name="Beijing">北京</li>
			<li id="sh">上海</li>
			<li>东京</li>
			<li>首尔</li>
		</ul>
		<br><br>
		<p>你喜欢哪款单机游戏?</p>
		<ul id="game">
			<li id="rl">红警</li>
			<li id="sk">实况</li>
			<li>极品飞车</li>
			<li>魔兽</li>
		</ul>
	</body>
</html>
